package com.my.ycv51.util;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.widget.Toast;

/**
 * @author YCKJ0827
 */
public class ToastUtils {

    public static void toast(Context ctx, String msg) {
        if (ctx != null && !TextUtils.isEmpty(msg)) {
            if (ctx instanceof Activity) {
                if (((Activity) ctx).isFinishing() || ((Activity) ctx).isDestroyed()) {
                    return;
                }
            }
            Toast.makeText(ctx.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
        }
    }
}
